<?php
function lay_ngay_thang_nam()
{
    date_default_timezone_set('Asia/Ho_Chi_Minh');
    $weekday = date("l");
    $weekday = strtolower($weekday);
    switch($weekday) {
        case 'monday':
            $weekday = 'Thứ hai';
            break;
        case 'tuesday':
            $weekday = 'Thứ ba';
            break;
        case 'wednesday':
            $weekday = 'Thứ tư';
            break;
        case 'thursday':
            $weekday = 'Thứ năm';
            break;
        case 'friday':
            $weekday = 'Thứ sáu';
            break;
        case 'saturday':
            $weekday = 'Thứ bảy';
            break;
        default:
            $weekday = 'Chủ nhật';
            break;
    }
    //echo $weekday.', '.date('d/m/Y H:i:s');
    echo $weekday.', '.date('d/m/Y');
} 
function kiem_tra_hinh_anh_ton_tai($target_file)
{
    // Check if file already exists
    if (file_exists($target_file)) {
    echo "Sorry, file already exists.";
    return false;
}
else return true;
}
function kiem_tra_kich_thuoc_hinh_anh($hinh_anh)
{
    // Check file size
    if ($hinh_anh["fileToUpload"]["size"] > 500000) {
    echo "Sorry, your file is too large.";
    return false;
}
else return true;
}
function kiem_tra_dinh_dang_anh($imageFileType)
{
    // Allow certain file formats
    if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
    && $imageFileType != "gif" ) {
    echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
    return false;
}
else return true;
}
?>